/*
 * Copyright 2020-2024 Steinar Bang
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations
 * under the License.
 */
package no.priv.bang.oldalbum.services.bean;

import java.util.Date;

public record ImageMetadata(
    int status,
    Date lastModified,
    String contentType,
    int contentLength,
    String title,
    String description)
{

    public static Builder with() {
        return new Builder();
    }

    public static class Builder {
        private int status;
        private Date lastModified;
        private String contentType;
        private int contentLength;
        private String title;
        private String description;

        private Builder() {}

        public ImageMetadata build() {
            return new ImageMetadata(status, lastModified, contentType, contentLength, title, description);
        }

        public Builder status(int status) {
            this.status = status;
            return this;
        }

        public Builder lastModified(Date lastModified) {
            this.lastModified = lastModified;
            return this;
        }

        public Builder contentType(String contentType) {
            this.contentType = contentType;
            return this;
        }

        public Builder contentLength(int contentLength) {
            this.contentLength = contentLength;
            return this;
        }

        public Builder title(String title) {
            this.title = title;
            return this;
        }

        public Builder description(String description) {
            this.description = description;
            return this;
        }

        public boolean descriptionIsNullOrEmpty() {
            return description == null || description.isBlank();
        }
    }

}
